package com.jiexinyun.dto.request.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

@Data
@Schema(name = "BasePageReq", description = "分页请求参数")
public class BasePageReq {

    @NotNull(message = "current不允许为空")
    @Min(value = 1, message = "最小页码1")
    @Schema(name = "current", description = "分页当前页码", example = "1")
    private Integer current;

    @NotNull(message = "size不允许为空")
    @Min(value = 1, message = "最小页长1")
    @Max(value = 100, message = "最大页长100")
    @Schema(name = "size", description = "分页大小", example = "100")
    private Integer size;

    @Schema(name = "orders", description = "排序规则", example = "[{\"column\":\"name\",\"sort\":\"asc\"}]")
    private List<Map<String,String>> orders;//数据类型是 [{"column":"name","sort":"asc"},{}]

}
